<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">

<head th:replace="common/head::head">
</head>

<body>
<div class="layui-form">
    <table class="layui-table">
        <tbody>
        <tr>
            <td>控制台日志路径</td>
            <td th:text="${data?.logPath}"></td>
        </tr>
        <tr>
            <td>控制台日志备份路径</td>
            <td th:text="${data?.logBackPath}"></td>
        </tr>
        </tbody>
    </table>
    <table class="layui-table">
        <thead>
        <tr>
            <th>序号</th>
            <th>文件名</th>
            <th>修改时间</th>
            <th>文件大小</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>

        <tr th:each="item : ${data?.array}">
            <td th:text="${item.index}"></td>
            <td th:text="${item.filename}"></td>
            <td th:text="${item.modifyTime}"></td>
            <td th:text="${item.fileSize}"></td>
            <td>
                <button op="a" th:href="@{logBack_download(key=${item.filename},id=${data?.id},copyId=${copyId})}"
                        class="layui-btn layui-btn-warm layui-btn-sm">下载
                </button>
                <button name="delete" th:data-name="${item.filename}" th:data-id="${data?.id}"
                        class="layui-btn layui-btn-danger layui-btn-sm">删除
                </button>
            </td>
        </tr>
        <tr th:if="${#lists.isEmpty(data?.array)}">
            <td colspan="5">没有相关信息</td>
        </tr>
        </tbody>
    </table>
</div>
</body>
<script type="text/javascript">
    var copyId = getQueryString("copyId");

    function loadSuccess() {
        $("button[name='delete']").click(function () {
            var that = $(this);
            var name = that.attr("data-name");
            layer.confirm('您确定要删除【' + name + '】？', {
                btn: ['确定', '不确定'] //按钮
            }, function (index) {
                layer.close(index);
                var id = that.attr("data-id");
                loadingAjax({
                    url: './logBack_delete',
                    data: {
                        id: id,
                        name: name,
                        copyId: copyId
                    },
                    success: function (data) {
                        layer.msg(data.msg);
                        if (200 === data.code) {
                            setTimeout(function () {
                                window.location.reload();
                            }, 2000);
                        }
                    }
                });
            }, function () {

            });
        });
    }
</script>
</html>
